package Presentacion;

import ModeloLogicoSistema.Imprimir;
import com.itextpdf.text.DocumentException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author debo
 */
public class VentanaPrincipal extends javax.swing.JDialog {

    /**
     * Creates new form VentanaPrincipal
     */
    public VentanaPrincipal(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setTitle("      Sistema De Lavanderia ");
        this.setLocationRelativeTo(null);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        MenuOrden = new javax.swing.JMenu();
        MenuItemAgregarOrden = new javax.swing.JMenuItem();
        MenuItemModificarOrden = new javax.swing.JMenuItem();
        MenuItemAnularOrden = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        MenuServicio = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        MenuCliente = new javax.swing.JMenu();
        jMenuItemAgregarCliente = new javax.swing.JMenuItem();
        jMenuItemModificarCliente = new javax.swing.JMenuItem();
        jMenuItemAnularCliente = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        MenuOrden.setText("Orden");

        MenuItemAgregarOrden.setText("Agregar Orden");
        MenuItemAgregarOrden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemAgregarOrdenActionPerformed(evt);
            }
        });
        MenuOrden.add(MenuItemAgregarOrden);

        MenuItemModificarOrden.setText("Modificar Orden");
        MenuItemModificarOrden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemModificarOrdenActionPerformed(evt);
            }
        });
        MenuOrden.add(MenuItemModificarOrden);

        MenuItemAnularOrden.setText("Anular Orden");
        MenuItemAnularOrden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemAnularOrdenActionPerformed(evt);
            }
        });
        MenuOrden.add(MenuItemAnularOrden);

        jMenuItem4.setText("Imprimir");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        MenuOrden.add(jMenuItem4);

        jMenuBar1.add(MenuOrden);

        MenuServicio.setText("Servicio");

        jMenuItem5.setText("Agregar Servicio");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        MenuServicio.add(jMenuItem5);

        jMenuItem6.setText("Modificar Servicio");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        MenuServicio.add(jMenuItem6);

        jMenuItem7.setText("Anular Servicio");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        MenuServicio.add(jMenuItem7);

        jMenuBar1.add(MenuServicio);

        MenuCliente.setText("Cliente");

        jMenuItemAgregarCliente.setText("Agregar Cliente");
        jMenuItemAgregarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAgregarClienteActionPerformed(evt);
            }
        });
        MenuCliente.add(jMenuItemAgregarCliente);

        jMenuItemModificarCliente.setText("Modificar Cliente");
        jMenuItemModificarCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemModificarClienteActionPerformed(evt);
            }
        });
        MenuCliente.add(jMenuItemModificarCliente);

        jMenuItemAnularCliente.setText("Anular Cliente");
        jMenuItemAnularCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemAnularClienteActionPerformed(evt);
            }
        });
        MenuCliente.add(jMenuItemAnularCliente);

        jMenuBar1.add(MenuCliente);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 279, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        Imprimir i = new Imprimir();
        BuscarOrden buscarOrden = null;
        try {
            buscarOrden = new BuscarOrden(null, rootPaneCheckingEnabled);
        } catch (SQLException ex) {
            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
        buscarOrden.setVisible(true);
       // try {
         //   i.tablaprincipal(WIDTH, null, null, DO_NOTHING_ON_CLOSE, null, null, null, HIDE_ON_CLOSE, null, null, Double.MAX_VALUE, null, Double.NaN, Double.MAX_VALUE, Double.NaN, Double.NaN);
            //Imprimir
    //        Imprimir imprimir = new Imprimir();
    //        try {
    //            imprimir.crearTicket(null, null);
    //        } catch (IOException ex) {
    //            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
    //        } catch (DocumentException ex) {
    //        }
    //        }
        /*} catch (IOException ex) {
            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        } catch (DocumentException ex) {
            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }*/
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void MenuItemModificarOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemModificarOrdenActionPerformed
        try {
            BuscarOrden buscarOrden = new BuscarOrden(null, rootPaneCheckingEnabled);
            buscarOrden.setVisible(true);
        } catch (Exception e) {
        }

    }//GEN-LAST:event_MenuItemModificarOrdenActionPerformed

    private void MenuItemAnularOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemAnularOrdenActionPerformed
        BuscarOrden buscarOrden = null;
        try {
            buscarOrden = new BuscarOrden(null, rootPaneCheckingEnabled);
        } catch (SQLException ex) {
            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
        buscarOrden.setVisible(true);

    }//GEN-LAST:event_MenuItemAnularOrdenActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        AltaServicio altaServicio1 = null;
        try {
            altaServicio1 = new AltaServicio(null, rootPaneCheckingEnabled);
        } catch (SQLException ex) {
            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
        altaServicio1.setVisible(true);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        BuscarServicios buscarServicios = new BuscarServicios(null, rootPaneCheckingEnabled);
        buscarServicios.setVisible(true);
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        BuscarServicios buscarServicios = new BuscarServicios(null, rootPaneCheckingEnabled);
        buscarServicios.setVisible(true);
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void MenuItemAgregarOrdenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemAgregarOrdenActionPerformed
        AltaOrden altaDeOrden = null;
        try {
            altaDeOrden = new AltaOrden(null, rootPaneCheckingEnabled);
        } catch (SQLException ex) {
            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
        altaDeOrden.setVisible(true);
    }//GEN-LAST:event_MenuItemAgregarOrdenActionPerformed

    private void jMenuItemAgregarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAgregarClienteActionPerformed
        AltaCliente altaCliente1 = null;
        try {
            altaCliente1 = new AltaCliente(null, rootPaneCheckingEnabled);
        } catch (SQLException ex) {
            Logger.getLogger(VentanaPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
        altaCliente1.setVisible(true);
    }//GEN-LAST:event_jMenuItemAgregarClienteActionPerformed

    private void jMenuItemModificarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemModificarClienteActionPerformed
        BuscarCliente buscarCliente = new BuscarCliente(null, rootPaneCheckingEnabled);
        buscarCliente.habilitarModificacion();
        buscarCliente.setVisible(true);
    }//GEN-LAST:event_jMenuItemModificarClienteActionPerformed

    private void jMenuItemAnularClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemAnularClienteActionPerformed
        BuscarCliente buscarCliente = new BuscarCliente(null, rootPaneCheckingEnabled);
        buscarCliente.habilitarEliminar();
        buscarCliente.setVisible(true);
    }//GEN-LAST:event_jMenuItemAnularClienteActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VentanaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                VentanaPrincipal dialog = new VentanaPrincipal(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu MenuCliente;
    private javax.swing.JMenuItem MenuItemAgregarOrden;
    private javax.swing.JMenuItem MenuItemAnularOrden;
    private javax.swing.JMenuItem MenuItemModificarOrden;
    private javax.swing.JMenu MenuOrden;
    private javax.swing.JMenu MenuServicio;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItemAgregarCliente;
    private javax.swing.JMenuItem jMenuItemAnularCliente;
    private javax.swing.JMenuItem jMenuItemModificarCliente;
    // End of variables declaration//GEN-END:variables
}
